package com.yochi.pictureseditor;

import android.app.Activity;
import android.content.Intent;

import com.yochi.pictureseditor.activities.BichromePicker;
import com.yochi.pictureseditor.activities.ColorPicker;
import com.yochi.pictureseditor.activities.CustomizeFilter;
import com.yochi.pictureseditor.activities.ParameterPicker;
import com.yochi.pictureseditor.activities.Parameters2Picker;
import com.yochi.pictureseditor.activities.Parameters3Picker;
import com.yochi.pictureseditor.effects.DoubleParameters;
import com.yochi.pictureseditor.effects.EffectEnum;
import com.yochi.pictureseditor.effects.TripleParameters;
import com.yochi.pictureseditor.effects.converters.ParameterConverter;
import com.yochi.pictureseditor.effects.filters.FilterEnum;

public class ParametersAskers {
	
	public static final int INTENT_PARAM_PICK = 201;
	public static final int INTENT_COLOR_PICK = 202;
	public static final int INTENT_FILTER_PICK = 203;
	public static final int INTENT_COLOR_PARAM_PICK = 204;
	public static final int INTENT_3_PARAMS_PICK = 205;
	public static final int INTENT_2_PARAMS_PICK = 206;
	
	////////////////////
	// PARAMETER PICK //
	////////////////////

	public static void askForParameterValue(Activity ctx, String name, int init, int max, ParameterConverter converter, EffectEnum effect) {
		Intent paramIntent = new Intent(ctx, ParameterPicker.class);
		paramIntent.putExtra("name", name);
		paramIntent.putExtra("init", init);
		paramIntent.putExtra("max", max);
		paramIntent.putExtra("effect", effect);
		paramIntent.putExtra("converter", converter);
		ctx.startActivityForResult(paramIntent, INTENT_PARAM_PICK);
	}
	
	public static void askFor3ParametersValues(Activity ctx, String name, TripleParameters parameters, ParameterConverter converter, EffectEnum effect) {
		Intent paramIntent = new Intent(ctx, Parameters3Picker.class);
		paramIntent.putExtra("name", name);
		paramIntent.putExtra("parameterN", parameters.getN());
		paramIntent.putExtra("parameterS", parameters.getS());
		paramIntent.putExtra("parameterR", parameters.getR());
		paramIntent.putExtra("effect", effect);
		ctx.startActivityForResult(paramIntent, INTENT_3_PARAMS_PICK);
	}
	
	public static void askFor2ParametersValues(Activity ctx, String name, DoubleParameters parameters, ParameterConverter converter, EffectEnum effect) {
		Intent paramIntent = new Intent(ctx, Parameters2Picker.class);
		paramIntent.putExtra("name", name);
		paramIntent.putExtra("parameterN", parameters.getN());
		paramIntent.putExtra("parameterR", parameters.getR());
		paramIntent.putExtra("effect", effect);
		ctx.startActivityForResult(paramIntent, INTENT_2_PARAMS_PICK);
	}

	public static void askForColorsParamValues(Activity ctx, String name, int max, EffectEnum effect) {
		Intent paramIntent = new Intent(ctx, BichromePicker.class);
		paramIntent.putExtra("name", name);
		paramIntent.putExtra("max", max);
		paramIntent.putExtra("effect", effect);
		ctx.startActivityForResult(paramIntent, INTENT_COLOR_PARAM_PICK);
	}

	public static void askForColorValue(Activity ctx) {
		Intent paramIntent = new Intent(ctx, ColorPicker.class);
		paramIntent.putExtra("name", "Select RGB color");
		paramIntent.putExtra("effect", EffectEnum.COLORIZE);
		ctx.startActivityForResult(paramIntent, INTENT_COLOR_PICK);
	}

	public static void askForPersonalizeFilter(Activity ctx) {
		Intent paramIntent = new Intent(ctx, CustomizeFilter.class);
		paramIntent.putExtra("name", "Customize filter");
		paramIntent.putExtra("effect", FilterEnum.PERSONALIZED);
		ctx.startActivityForResult(paramIntent, INTENT_FILTER_PICK);
	}

}
